<template>
	<view class="web-view">
		<web-view @onPostMessage="handlePostMessage" :webview-styles="webviewStyles" :src="src" fullscreen></web-view>
	</view>
</template>

<script>
	export default {
		props: {
			src: {
				type: String,
				default: ''
			},
		},
		data() {
			return {
				webviewStyles: {
					progress: {
						color: this.$lightColor,
					},
				}
			};
		},
		methods: {
			// webview向外部发送消息
			handlePostMessage(data) {
				console.log(data)
			}
		},
	};
</script>

<style lang='scss' scoped>
	@import './index.scss';
	.web-view {
		/deep/ .web-view {
			padding: 0;
			margin: 0;
		}
	}
</style>